package com.springboot.cloud.authentication.config;

import com.springboot.cloud.authentication.service.ResourceService;
import org.springframework.context.annotation.Bean;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <p> 加载所有的资源 </p>
 *
 * @author Bertram
 * @since 11/5/2019 2:42 PM
 */
@Component
public class LoadResourceDefine {

    private ResourceService resourceService;

    public LoadResourceDefine(ResourceService resourceService) {
        this.resourceService = resourceService;
    }

    @Bean
    public Map<RequestMatcher, ConfigAttribute> resourceConfigAttributes() {
        return resourceService.loadResource();
    }
}
